home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000125_icon-group-sender _Wed Jul 8 14:02:10 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id OAA02671
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 8 Jul 1998 14:02:09 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA10436; Wed, 8 Jul 1998 14:01:56 -0700
  7. Date: Tue, 7 Jul 1998 21:42:48 -0500 (CDT)
  8. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  9. To: David Starner <dstarner98@aasaa.ofe.org>
  10. Cc: icon-group@optima.CS.Arizona.EDU
  11. Subject: Re: Stripping excessive spaces
  12. In-Reply-To: <35A2750A.E12A0673@aasaa.ofe.org>
  13. Message-Id: <Pine.SOL.3.96.980707214057.20216A-100000@post.its.mcw.edu>
  14. Mime-Version: 1.0
  15. Content-Type: TEXT/PLAIN; charset=US-ASCII
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 1117
  19.  
  20. try
  21.  
  22. new := reverse(trim(reverse(trim(str))))
  23.  
  24. Chris Tenaglia   (system manager)     |  The future foretold,
  25. Medical College of Wisconsin          |  The past explained,
  26. 8701 W. Watertown Plank Rd.           |  The present largely appologized for.
  27. Milwaukee, WI 53226   (414)456-8765   |  Organon to the Doctor
  28.  
  29.  
  30. On Tue, 7 Jul 1998, David Starner wrote:
  31.  
  32. > Date: Tue, 07 Jul 1998 13:20:42 -0600
  33. > From: David Starner <dstarner98@aasaa.ofe.org>
  34. > To: icon-group@optima.CS.Arizona.EDU
  35. > Subject: Stripping excessive spaces
  36. > I've just started programming in Icon, and I came across the problem of
  37. > removing all the starting and ending spaces from a string. This was my
  38. > solution, but I think it's terribly inefficent. Can some one help me
  39. > with a better way to do this?
  40. > procedure clip(s1)
  41. >     if type(s1) == "null" then fail
  42. >     s1 ?:= {
  43. >         tab(many(' ')) & tab(0)
  44. >         }
  45. >     s1 := reverse(s1)
  46. >     s1 ?:= {
  47. >         tab(many(' ')) & tab(0)
  48. >         }
  49. >     s1 := reverse(s1)
  50. >     return s1
  51. > end
  52. > -- 
  53. > David Starner - dvdeug@hotmail.com, dstarner98@aasaa.ofe.org
  54. > GURPS: http://www.geocities.com/TimesSquare/Ring/7895/
  55.  
  56.